Optimal. Leaf size=170 \[ -\frac{\left (2 a^2-b^2\right ) \sin ^{n+3}(c+d x)}{d (n+3)}+\frac{\left (a^2-2 b^2\right ) \sin ^{n+5}(c+d x)}{d (n+5)}+\frac{a^2 \sin ^{n+1}(c+d x)}{d (n+1)}+\frac{2 a b \sin ^{n+2}(c+d x)}{d (n+2)}-\frac{4 a b \sin ^{n+4}(c+d x)}{d (n+4)}+\frac{2 a b \sin ^{n+6}(c+d x)}{d (n+6)}+\frac{b^2 \sin ^{n+7}(c+d x)}{d (n+7)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.213198, antiderivative size = 170, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 29, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.069, Rules used = {2837, 948} \[ -\frac{\left (2 a^2-b^2\right ) \sin ^{n+3}(c+d x)}{d (n+3)}+\frac{\left (a^2-2 b^2\right ) \sin ^{n+5}(c+d x)}{d (n+5)}+\frac{a^2 \sin ^{n+1}(c+d x)}{d (n+1)}+\frac{2 a b \sin ^{n+2}(c+d x)}{d (n+2)}-\frac{4 a b \sin ^{n+4}(c+d x)}{d (n+4)}+\frac{2 a b \sin ^{n+6}(c+d x)}{d (n+6)}+\frac{b^2 \sin ^{n+7}(c+d x)}{d (n+7)} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2837
Rule 948
Rubi steps
\begin{align*} \int \cos ^5(c+d x) \sin ^n(c+d x) (a+b \sin (c+d x))^2 \, dx &=\frac{\operatorname{Subst}\left (\int \left (\frac{x}{b}\right )^n (a+x)^2 \left (b^2-x^2\right )^2 \, dx,x,b \sin (c+d x)\right )}{b^5 d}\\ &=\frac{\operatorname{Subst}\left (\int \left (a^2 b^4 \left (\frac{x}{b}\right )^n+2 a b^5 \left (\frac{x}{b}\right )^{1+n}-b^4 \left (2 a^2-b^2\right ) \left (\frac{x}{b}\right )^{2+n}-4 a b^5 \left (\frac{x}{b}\right )^{3+n}+b^4 \left (a^2-2 b^2\right ) \left (\frac{x}{b}\right )^{4+n}+2 a b^5 \left (\frac{x}{b}\right )^{5+n}+b^6 \left (\frac{x}{b}\right )^{6+n}\right ) \, dx,x,b \sin (c+d x)\right )}{b^5 d}\\ &=\frac{a^2 \sin ^{1+n}(c+d x)}{d (1+n)}+\frac{2 a b \sin ^{2+n}(c+d x)}{d (2+n)}-\frac{\left (2 a^2-b^2\right ) \sin ^{3+n}(c+d x)}{d (3+n)}-\frac{4 a b \sin ^{4+n}(c+d x)}{d (4+n)}+\frac{\left (a^2-2 b^2\right ) \sin ^{5+n}(c+d x)}{d (5+n)}+\frac{2 a b \sin ^{6+n}(c+d x)}{d (6+n)}+\frac{b^2 \sin ^{7+n}(c+d x)}{d (7+n)}\\ \end{align*}
Mathematica [A] time = 0.661141, size = 139, normalized size = 0.82 \[ \frac{\sin ^{n+1}(c+d x) \left (\frac{\left (a^2-2 b^2\right ) \sin ^4(c+d x)}{n+5}-\frac{\left (2 a^2-b^2\right ) \sin ^2(c+d x)}{n+3}+\frac{a^2}{n+1}+\frac{2 a b \sin ^5(c+d x)}{n+6}-\frac{4 a b \sin ^3(c+d x)}{n+4}+\frac{2 a b \sin (c+d x)}{n+2}+\frac{b^2 \sin ^6(c+d x)}{n+7}\right )}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F] time = 10.642, size = 0, normalized size = 0. \begin{align*} \int \left ( \cos \left ( dx+c \right ) \right ) ^{5} \left ( \sin \left ( dx+c \right ) \right ) ^{n} \left ( a+b\sin \left ( dx+c \right ) \right ) ^{2}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 2.34373, size = 1408, normalized size = 8.28 \begin{align*} -\frac{{\left (2 \,{\left (a b n^{6} + 22 \, a b n^{5} + 190 \, a b n^{4} + 820 \, a b n^{3} + 1849 \, a b n^{2} + 2038 \, a b n + 840 \, a b\right )} \cos \left (d x + c\right )^{6} - 16 \, a b n^{4} - 256 \, a b n^{3} - 2 \,{\left (a b n^{6} + 18 \, a b n^{5} + 118 \, a b n^{4} + 348 \, a b n^{3} + 457 \, a b n^{2} + 210 \, a b n\right )} \cos \left (d x + c\right )^{4} - 1376 \, a b n^{2} - 2816 \, a b n - 8 \,{\left (a b n^{5} + 16 \, a b n^{4} + 86 \, a b n^{3} + 176 \, a b n^{2} + 105 \, a b n\right )} \cos \left (d x + c\right )^{2} - 1680 \, a b +{\left ({\left (b^{2} n^{6} + 21 \, b^{2} n^{5} + 175 \, b^{2} n^{4} + 735 \, b^{2} n^{3} + 1624 \, b^{2} n^{2} + 1764 \, b^{2} n + 720 \, b^{2}\right )} \cos \left (d x + c\right )^{6} - 8 \,{\left (a^{2} + b^{2}\right )} n^{4} -{\left ({\left (a^{2} + b^{2}\right )} n^{6} +{\left (23 \, a^{2} + 17 \, b^{2}\right )} n^{5} + 3 \,{\left (69 \, a^{2} + 37 \, b^{2}\right )} n^{4} + 5 \,{\left (185 \, a^{2} + 71 \, b^{2}\right )} n^{3} + 8 \,{\left (268 \, a^{2} + 73 \, b^{2}\right )} n^{2} + 1008 \, a^{2} + 144 \, b^{2} + 36 \,{\left (67 \, a^{2} + 13 \, b^{2}\right )} n\right )} \cos \left (d x + c\right )^{4} - 8 \,{\left (19 \, a^{2} + 13 \, b^{2}\right )} n^{3} - 64 \,{\left (16 \, a^{2} + 7 \, b^{2}\right )} n^{2} - 4 \,{\left ({\left (a^{2} + b^{2}\right )} n^{5} + 2 \,{\left (10 \, a^{2} + 7 \, b^{2}\right )} n^{4} + 3 \,{\left (49 \, a^{2} + 23 \, b^{2}\right )} n^{3} + 4 \,{\left (121 \, a^{2} + 37 \, b^{2}\right )} n^{2} + 336 \, a^{2} + 48 \, b^{2} + 4 \,{\left (173 \, a^{2} + 35 \, b^{2}\right )} n\right )} \cos \left (d x + c\right )^{2} - 2688 \, a^{2} - 384 \, b^{2} - 32 \,{\left (89 \, a^{2} + 23 \, b^{2}\right )} n\right )} \sin \left (d x + c\right )\right )} \sin \left (d x + c\right )^{n}}{d n^{7} + 28 \, d n^{6} + 322 \, d n^{5} + 1960 \, d n^{4} + 6769 \, d n^{3} + 13132 \, d n^{2} + 13068 \, d n + 5040 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.18212, size = 776, normalized size = 4.56 \begin{align*} \frac{\frac{{\left (n^{2} \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{5} + 4 \, n \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{5} - 2 \, n^{2} \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{3} + 3 \, \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{5} - 12 \, n \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{3} + n^{2} \sin \left (d x + c\right )^{n} \sin \left (d x + c\right ) - 10 \, \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{3} + 8 \, n \sin \left (d x + c\right )^{n} \sin \left (d x + c\right ) + 15 \, \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )\right )} a^{2}}{n^{3} + 9 \, n^{2} + 23 \, n + 15} + \frac{2 \,{\left (n^{2} \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{6} + 6 \, n \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{6} - 2 \, n^{2} \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{4} + 8 \, \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{6} - 16 \, n \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{4} + n^{2} \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{2} - 24 \, \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{4} + 10 \, n \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{2} + 24 \, \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{2}\right )} a b}{n^{3} + 12 \, n^{2} + 44 \, n + 48} + \frac{{\left (n^{2} \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{7} + 8 \, n \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{7} - 2 \, n^{2} \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{5} + 15 \, \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{7} - 20 \, n \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{5} + n^{2} \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{3} - 42 \, \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{5} + 12 \, n \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{3} + 35 \, \sin \left (d x + c\right )^{n} \sin \left (d x + c\right )^{3}\right )} b^{2}}{n^{3} + 15 \, n^{2} + 71 \, n + 105}}{d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]